package com.inmerweb.app.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.inmerweb.app.commons.BaseEntity;

/**
 * Entidad para representar la informacion de usuario
 * 
 * @author Daniel Pascual Sanchez
 *
 */

@Entity
@Table(name = "appusers_inmer_his")
public class InmersionEntity extends BaseEntity {

	private static final long serialVersionUID = 8451918470645398698L;
	
	@Column(columnDefinition="DATETIME")
	@Temporal(TemporalType.TIMESTAMP)
	private Date inmer_date;
	
	private String coef_prev;
	private String coef_salida;
	private double lat;
	private double lng;
	private int profundidad;
	
	// Mapeo de columnas para clave foranea y para la lista de actividades de un usuario

	  private UserEntity userE;	
	
	@ManyToOne (fetch=FetchType.EAGER)
	@JoinColumn(name="user_id",referencedColumnName="userName")
	public UserEntity getUser() {
		return userE;
	}
	public void setUser(UserEntity user) {
		this.userE = user;
		// user.addInmersionToInmersionList(this);
	}
	

	//====================================================================================
	/*
	// Los datos del usuario se obtienen a partir de user de tipo UserEntity
	private String user_id;
	public String getUser_id() {
		return user_id;
	}
	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}
	*/
	public Date getInmer_date() {
		return inmer_date;
	}
	public void setInmer_date(Date inmer_date) {
		this.inmer_date = inmer_date;
	}
	public String getCoef_prev() {
		return coef_prev;
	}
	public void setCoef_prev(String coef_prev) {
		this.coef_prev = coef_prev;
	}
	public String getCoef_salida() {
		return coef_salida;
	}
	public void setCoef_salida(String coef_salida) {
		this.coef_salida = coef_salida;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public double getLat() {
		return lat;
	}
	public void setLat(double lat) {
		this.lat = lat;
	}
	public double getLng() {
		return lng;
	}
	public void setLng(double lng) {
		this.lng = lng;
	}
	public int getProfundidad() {
		return profundidad;
	}
	public void setProfundidad(int profundidad) {
		this.profundidad = profundidad;
	}

}
